<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<meta HTTP-EQUIV="Pragma" CONTENT="no-cache">
	<meta HTTP-EQUIV="Cache-Control" CONTENT="no-cache">
	<meta HTTP-EQUIV="Expires" CONTENT="0">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>用户管理</title>
<style type="text/css">
	@import "../dojo-release-1.5.0/dijit/themes/tundra/tundra.css";
	@import "../dojo-release-1.5.0/dojo/resources/dojo.css";
	@import "../dojo-release-1.5.0/dojox/grid/resources/tundraGrid.css";
</style>
<script type="text/javascript" src="../dojo-release-1.5.0/dojo/dojo.js" djConfig="parseOnLoad:true"></script>
<script type="text/javascript" src="../framework/uiutil.js"></script>
<script type="text/javascript" src="../framework/simpleCRUDUtil.js"></script>
<script type="text/javascript">
var SCU = new SimpleCrudUtil({
	c:"../bkgrd/saveUser.do",
	r:"../bkgrd/getAllUser.do",
	d:"../bkgrd/deleteUser.do",
	grid:"grid",
	idName:"username",
	translateFun:function(item){
		item["roleText"] = {MANAGER:"管理员",TESTOR:"测试人员",SUPER_TESTOR:"高级测试人员"}[item["role"]];
	}
});
dojo.addOnLoad(function(){
	SCU.R();
});

function saveUser(){
	var username = dojo.byId("username").value;
	var role = D.getComboValue("userRole");
	
	if(username == ''||role==''){
		alert("请输入用户名并指定用户角色");
		return;
	}
	SCU.C({username:username,role:role});
}

//删除参数
function deleteUser(){
	SCU.D();
}
</script>

<style type="text/css">
#grid{
	border:1px solid #333;
	width:95%;
	margin:10px;
	height:500px;
	font-size:0.9em;
}
</style>
</head>
<body class="tundra">

新增用户
<table width="100%">
<tr><td>用户名</td><td><input type="text" dojoType="dijit.form.TextBox" id="username" size="30" trim="true" value=""/></td></tr>
<tr><td>初始密码</td><td>000000</td></tr>
<tr><td>用户角色</td><td>
<select dojoType="dijit.form.FilteringSelect" id="userRole" value="">
	<option value="TESTOR" selected="selected">检测员</option>
	<option value="SUPER_TESTOR">高级测试人员</option>
	<option value="MANAGER">管理员</option>
</select>
</td></tr>
<tr><td colspan="2">
<button dojoType="dijit.form.Button" id="query" onclick="saveUser()">保存用户</button>
<button dojoType="dijit.form.Button" id="delete" onclick="deleteUser()">删除用户</button>
</td></tr>
</table>

<table dojoType="dojox.grid.DataGrid" id="grid"  autoWidth="true">
 <thead>
	<tr>
	     <th field="username" width="200px">用户名</th>
	     <th field="roleText" width="200px">角色</th>
	</tr>
</thead>
</table>
</body>
</html>